package com.travel.controller.user;

import com.travel.result.Result;
import com.travel.service.WeatherUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.Map;

/**
 * Author:Jasenon_ce
 * Date: 2025.04.28/下午10:10
 */
@RestController
@RequestMapping("/weather")
public class UserWeatherController {

    @ApiOperation(value = "刷新天气token")
    @GetMapping("/refresh")
    public Result refreshWeatherToken() throws NoSuchAlgorithmException, InvalidKeySpecException {
        String token = WeatherUtil.createToken();
        return Result.success(Map.of("token",token));
    }

}
